package com.fyy.singleton;

/**
 * @Author fyy
 * @Description
 * @Date 2020/7/17 14:14
 */
public class StaticSingleton {

    //创建一个静态私有的类,通过内部类的调用实现懒加载
    private static class StaticSingletonHolder{
        private static final StaticSingleton INSTANCE = new StaticSingleton();
    }

    //构造方法私有化，使其不能被实例化
    private StaticSingleton (){

    }

    //获取唯一可用对象
    public static StaticSingleton getInstance(){
        return StaticSingletonHolder.INSTANCE;
    }

}
